001    /*
002     * About.java
003     *
004     * Copyright 2003 Sergio Anibal de Carvalho Junior
005     *
006     * This file is part of NeoBio.
007     *
008     * NeoBio is free software; you can redistribute it and/or modify it under the terms of
009     * the GNU General Public License as published by the Free Software Foundation; either
010     * version 2 of the License, or (at your option) any later version.
011     *
012     * NeoBio is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
013     * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
014     * PURPOSE. See the GNU General Public License for more details.
015     *
016     * You should have received a copy of the GNU General Public License along with NeoBio;
017     * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
018     * Boston, MA 02111-1307, USA.
019     *
020     * Proper attribution of the author as the source of the software would be appreciated.
021     *
022     * Sergio Anibal de Carvalho Junior             mailto:sergioanibaljr@users.sourceforge.net
023     * Department of Computer Science               http://www.dcs.kcl.ac.uk
024     * King's College London, UK                    http://www.kcl.ac.uk
025     *
026     * Please visit http://neobio.sourceforge.net
027     *
028     * This project was supervised by Professor Maxime Crochemore.
029     *
030     */
031    
032    package neobio.gui;
033    
034    import java.awt.*;
035    import java.awt.event.*;
036    import javax.swing.*;
037    import java.net.URL;
038    
039    /**
040     * About screen.
041     *
042     * @author Sergio A. de Carvalho Jr.
043     */
044    public class AboutDialog extends JDialog
045    {
046            private JLabel image_label;
047    
048            /**
049             * Creates a new instance of the About screen.
050             *
051             * @param parent the parent frame
052             */
053        public AboutDialog (Frame parent)
054        {
055            super (parent, true);
056            initComponents ();
057            pack ();
058        }
059    
060        private void initComponents ()
061        {
062                    URL     image_filename;
063    
064            setTitle ("About");
065            setResizable (false);
066            setDefaultCloseOperation (WindowConstants.DISPOSE_ON_CLOSE);
067    
068            addWindowListener (new WindowAdapter ()
069            {
070                public void windowClosing (WindowEvent e)
071                {
072                    closeDialog (e);
073                }
074            });
075    
076                    image_filename = getClass().getResource("icons/about.jpg");
077                    if (image_filename != null)
078                    {
079                            image_label = new JLabel ();
080                    image_label.setIcon(new ImageIcon(image_filename));
081                    getContentPane().add(image_label, BorderLayout.CENTER);
082                    }
083        }
084    
085        private void closeDialog(WindowEvent e)
086        {
087            setVisible (false);
088            dispose ();
089        }
090    }